package com.example.idachuappone.cook.entity;

import java.io.Serializable;
import org.json.JSONObject;

public class WorkDayTime implements Serializable {
    private String from;
    private String to;
    private int weekday;

    public WorkDayTime parseJson(JSONObject json) {
        if (json == null) {
            return null;
        }
        if (json.has("weekday")) {
            this.weekday = json.optInt("weekday");
        }
        if (json.has("from")) {
            this.from = json.optString("from");
        }
        if (!json.has("to")) {
            return this;
        }
        this.to = json.optString("to");
        return this;
    }

    public int getWeekday() {
        return this.weekday;
    }

    public void setWeekday(int weekday) {
        this.weekday = weekday;
    }

    public String getFrom() {
        return this.from;
    }

    public void setFrom(String from) {
        this.from = from;
    }

    public String getTo() {
        return this.to;
    }

    public void setTo(String to) {
        this.to = to;
    }
}
